package com.senlingspace.common.enums;

/**
 * 订单类型
 *
 * @author lebronjames
 * @date 2024/07/30
 */
public enum OrderType {

    // 101=门票、102=商品、103=门票+商品',
    OT_101(101,"门票"),
    OT_102(102,"商品"),
    OT_103(103,"门票+商品");

    private final int code;
    private final String description;

    OrderType(int code,String description) {
        this.code = code;
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public int getCode() {
        return code;
    }

    public static OrderType fromCode(int code) {
        for (OrderType type : OrderType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }

}
